package com.qf.cx.simplenms.reader.model;

/**
 *
 * 当 readerName protocol 和 antennaNo 相等时认为是同一个天线
 * @author wanghaoming
 *
 */
public class AntennaModel {
	private ReaderModel readerModel;
	private int antennaNo;
	private int protocol;
	private String readerName;

	public ReaderModel getReaderModel() {
		return readerModel;
	}

	public void setReaderModel(ReaderModel readerModel) {
		this.readerModel = readerModel;
		this.readerName = readerModel.getName();
	}

	public int getAntennaNo() {
		return antennaNo;
	}

	public void setAntennaNo(int antennaNo) {
		this.antennaNo = antennaNo;
	}

	public int getProtocol() {
		return protocol;
	}

	public void setProtocol(int protocol) {
		this.protocol = protocol;
	}

	public String getReaderName() {
		return readerName;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + antennaNo;
		result = prime * result + protocol;
		result = prime * result + ((readerName == null) ? 0 : readerName.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		AntennaModel other = (AntennaModel) obj;
		if (antennaNo != other.antennaNo) {
			return false;
		}
		if (protocol != other.protocol) {
			return false;
		}
		if (readerName == null) {
			if (other.readerName != null) {
				return false;
			}
		} else if (!readerName.equals(other.readerName)) {
			return false;
		}
		return true;
	}

	@Override
	public String toString() {
		return "AntennaModel [antennaNo=" + antennaNo + ", protocol=" + protocol + ", readerName=" + readerName + "]";
	}
}
